In [5]:
earthquake = {
'rms': '1.85',
'updated': '2014-06-11T05:22:21.596Z',
'type': 'earthquake',
'magType': 'mwp',
'longitude': '-136.6561',
'gap': '48',
'depth': '10',
'dmin': '0.811',
'mag': '5.7',
'time': '2014-06-04T11:58:58.200Z',
'latitude': '59.0001',
'place': '73km WSW of Haines, Alaska',
'net': 'us',
'nst': '',
'id': 'usc000rauc'}
depth_to_words will describe the earthquake's depth
In [11]:
# Shallow earthquakes are between 0 and 70 km deep;
#intermediate earthquakes, 70 - 300 km deep;
#and deep earthquakes, 300 - 700 km deep.
def depth_to_words(earthquake):
depth = int(earthquake['depth'])
if depth < 70:
return("The earthquake was shallow")
elif 70 < depth < 300:
return("The earthquake was intermediate")
elif 300 < depth < 700:
return("The earthquak was deep")
return print("The earthquake had a depth of", earthquake['depth'])
depth_to_words(earthquake)
Out[11]:
magnitude_to_words will describe the earthquake's power
day_in_words should be the day of the week
time_in_words should be "morning", "afternoon", "evening" or "night"
date_in_words should be "Monthname day", e.g. "June 22"